package com.atguigu.lease.common.handler;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 *
 */

@Component
public class myMetaObjectHandler implements MetaObjectHandler {
    @Override
    public void insertFill(MetaObject metaObject) {
        //自动填充时间属性值
        this.strictInsertFill(metaObject, "createTime", Date.class,new Date());
        //自动回显
        this.strictInsertFill(metaObject,"isDeleted", Byte.class,(byte)0);
    }

    @Override
    public void updateFill(MetaObject metaObject) {
//        this.strictInsertFill(metaObject,"updateTime",Date.class, new Date());
        this.strictUpdateFill(metaObject,"updateTime",Date.class,new Date());


    }
}
